let express = require('express');
let router = express.Router();

const MongooseOperate = require('./mgoperate');
let mgop = new MongooseOperate();
mgop.productSave1();
mgop.productSave2();
mgop.productSave3();
mgop.productSave4();


router.get('/', function (req, res, next) {
    res.send('欢迎进入小程序后台根页面')
});


//查询商品
router.get('/getproduct', function (req, res, next) {

    mgop.ProductModel.findOne({ID: req.query.ID}, function (err, user) {
        console.log('【查询完成】:', err, user);
        res.set({'Access-Control-Allow-Origin': '*'});
        res.send(user)
    });

});


module.exports = router;
